package api

import (
	"github.com/gin-gonic/gin"
	"hitme/go-api/logic/controllers"
	"hitme/go-api/logic/middlewares"
)

func ApiV1Router(Router *gin.RouterGroup) {
	// 微信登录
	Router.POST("/wxlogin", controllers.WechatController.Login)

	// 意见反馈
	Router.POST("/feed_back", controllers.FeedBackController.Create)

	// 图片规格管理
	groupGroup := Router.Group("photo_spec")
	{
		groupGroup.GET("/list", controllers.PhotoSpecController.GetList)
		groupGroup.GET("/cate/list", controllers.PhotoSpecController.GetCateList)
		groupGroup.GET("/list_cate", controllers.PhotoSpecController.GetListByCate)
		groupGroup.POST("/cut_check_pic", controllers.PhotoSpecController.CutCheckPic)
		groupGroup.POST("/cut_change_clothes", controllers.PhotoSpecController.CutChangeClothes)
	}

	// 图片规格管理V1
	idcardGroup := Router.Group("idcard")
	{
		idcardGroup.GET("/list", controllers.IdcardController.GetList)
		idcardGroup.GET("/cate/list", controllers.IdcardController.GetCateList)
		idcardGroup.GET("/list_cate", controllers.IdcardController.GetListByCate)
		idcardGroup.POST("/env_make", controllers.IdcardController.EnvMakeWm)
		idcardGroup.POST("/change_cloth", controllers.IdcardController.ChangeClothWm)
	}

	// 订单支付回调
	Router.POST("/order/callback", controllers.OrderController.Callback)

	// 定时任务
	Router.GET("/oss_file/crontab", controllers.OssFileController.Crontab)

	// 订单管理
	authGroup := Router.Use(middlewares.JWTAuth())
	{
		// 创建订单
		authGroup.POST("/order", controllers.OrderController.Create)

		// 订单列表
		authGroup.GET("/order", controllers.OrderController.GetList)

		// 订单支付参数
		authGroup.GET("/order/param", controllers.OrderController.GetParams)

		// 订单刷新
		authGroup.GET("/order/refresh", controllers.OrderController.RefreshOrder)
	}
}
